window.workspace = function(){
	var response  = <?#$respons?>;
	var store, grid;
	var sid = {'userid':Ext.id(), 'status':Ext.id(), 'paytype':Ext.id(), 'sdate':Ext.id(), 'edate':Ext.id()};
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url			: '/admin/live/finance/withdraw/dolist.html',
	    remoteSort	: true,
	    sortInfo	: {
	            field		: 'id',
	            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
		fields			: ['id', 'paytype', 'sn', 'userid', 'paystate', 'type', 'addtime', 'coins', 'money', 'state', 
		    'opuser', 'paypal', 'user', 'link', 'vmoney', 'status', 'memo', 'stime', 'payment', 'accoutstate']
	});
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
		columns		: [
			{header: '编号[ID]', width:50, sortable:true, dataIndex:'id'},
			{header: '提现类别[Type]', width:60, sortable:true, dataIndex:'paytype', renderer:function(v) {
				return response.paytype[v];
			}},
			{header: '订单号[SN]', width:90, dataIndex:'sn', renderer:function(v, meta, obj){
				return '<a href="'+obj.get('link')+'" target="_blank">'+v+'</a>';
			}},
			{header: '主播[Anchor]', width:100, dataIndex:'user'},
			{header: '交易类型[PeyType]', width:120, sortable:true, dataIndex:'type', renderer:function(v,meta,obj) {
				return obj.get('payment');
			}},
			{header: '申请时间[ApplyTime]', width:100, sortable:true, dataIndex:'addtime'},
			{header: '提现金额[Amounts]', width:60, dataIndex:'money', sortable:true, renderer:function(v,meta,obj){
				if(obj.get('status') == 0 && obj.get('money') > obj.get('vmoney')) {
					return v+'<span style="color:red">余额不足[Balance Not Enough]</span>';
				}
				return v;
			}},
			{header: '余额[Balance]', width:60, dataIndex:'vmoney'},
			{header: '账号状态[StripeAccountState]', width:60, dataIndex:'accoutstate',renderer:function(v){
				return response.checkstate[v];
			}},
			{header: '支付状态[PayState]', width:60, sortable:true, dataIndex:'paystate', renderer:function(v){
				return response.status[v];
			}},
			{header: '交易编号[TranID]', width:80, dataIndex:'tranid'},
			{header: '运营审核[Operator]', width:70, dataIndex:'opuser'},
			{header: '审核状态[Status]', width:60, sortable:true, dataIndex:'status', renderer:function(v) {
				return response.checkstate[v];
			}},
			{header: '财务审核[Operator]', width:70, dataIndex:'operator'},
			{header: '审核状态[Status]', width:60, sortable:true, dataIndex:'state', renderer:function(v) {
				return response.checkstate[v];
			}},
			{header: '更新时间[LastTime]',width:80, sortable:true, dataIndex:'stime'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
	    listeners	: {
	    	'render':function(obj){
				main.gridRender(obj, ['failure', 'memo']);
	    	}
		},
	    stripeRows	: true,
	    tbar		: [{
			text	: '刷新[Reload]',
			iconCls	: 'icon-refresh',
			handler : function(){
				store.reload(); 
			}
	    },'-','主播[Anchor]:',{
			xtype		: 'combo',
			store		: new Ext.data.JsonStore({
				url	: '/admin/live/share/douser.html',
				autoDestroy: true,
				fields: ['id', 'name'],
				root: 'dataset'
			}),
			id	    	    : sid.userid,
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'Selected...',
			minChars		: 1,
			 pageSize		: 10,
			listWidth		: 258,
			width			: 160,
			typeAhead		: true,
			typeAheadDelay  : 0,
			triggerAction	: 'all',
			enableKeyEvents : true,
			mode			: 'remote'
		},'-','支付状态[PayState]:',{
			xtype		: 'combo',
			store		: new Ext.data.ArrayStore({
		        fields: ['id','name'],
		        data: main.cv2Array(response.status)
		    }),
			displayField	: 'name',
			valueField		: 'id',
			mode			: 'local',
			triggerAction	: 'all',
			emptyText		: 'selected...',
			width			: 100,
			id  			: sid.status
		},'-','添加时间[ApplyTime]:',{
			xtype       : 'datefield',
			id  		: sid.sdate,
			format      : 'Y-m-d',
			width	    : 90
		},'<->',{
			xtype       : 'datefield',
			id  		: sid.edate,
			format      : 'Y-m-d',
			width	    : 90
		},'-',{
			text			: '检索[Search]',
			iconCls			: 'icon-search',
			handler: function() {
				store.baseParams.userid   = Ext.getCmp(sid.userid).getValue();
				store.baseParams.status   = Ext.getCmp(sid.status).getValue();
				store.baseParams.sdate    = Ext.getCmp(sid.sdate).getValue();
				store.baseParams.edate    = Ext.getCmp(sid.edate).getValue();
				store.reload(); 
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();